package com.molin.threadTest.SetDeamoTest;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class Demo {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        MyRunnable myRunnable = new MyRunnable();
        Thread thread = new Thread(myRunnable);
        thread.setName("备胎");
        //设置守护线程
        thread.setDaemon(true);
        thread.start();

        MyCallable myCallable = new MyCallable();
        FutureTask<String> futureTask = new FutureTask<String>(myCallable);
        Thread nvs = new Thread(futureTask);
        nvs.setName("女神");
        nvs.start();
        String result = futureTask.get();
        System.out.println(result);

    }
}
